package com.ljf.config.infra.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ljf.common.exception.ServiceException;
import com.ljf.common.infra.repository.impl.BasisRepositoryImpl;
import com.ljf.common.utils.CollectionUtil;
import com.ljf.config.domain.repository.ConfigDatImpulseSenderConditionRepository;
import com.ljf.config.dto.query.ConfigDatImpulseSenderConditionQuery;
import com.ljf.config.infra.mapper.ConfigDatImpulseSenderConditionMapper;
import com.ljf.config.model.ConfigDatImpulseSenderCondition;
import com.ljf.config.vo.ConfigDatImpulseSenderConditionVO;
import org.springframework.stereotype.Component;

/**
 * 发号器配置状态  数据访问接口实现
 *
 * @author LJF
 * @since 2025-01-18
 */
@Component
public class ConfigDatImpulseSenderConditionRepositoryImpl extends BasisRepositoryImpl<ConfigDatImpulseSenderConditionMapper, ConfigDatImpulseSenderCondition, ConfigDatImpulseSenderConditionQuery, ConfigDatImpulseSenderConditionVO> implements ConfigDatImpulseSenderConditionRepository {

    @Override
    protected QueryWrapper<ConfigDatImpulseSenderCondition> fillWrapper(ConfigDatImpulseSenderConditionQuery query, boolean sort) throws ServiceException {
        QueryWrapper<ConfigDatImpulseSenderCondition> wrapper = super.fillWrapper(query, sort);
        if (CollectionUtil.isNotEmpty(query.getCodeList())) {
            wrapper.in(ConfigDatImpulseSenderCondition.COL_CODE, query.getCodeList());
        }
        return wrapper;
    }

}
